#ifndef __OBSERVABLE_H__
#define __OBSERVABLE_H__

#include <list>
#include "observer.h"


class Observable{
	private:
		typedef std::list<Observer*> ObserverList;

		ObserverList observers;

	public:
		Observable(){}
		virtual ~Observable(){}

		virtual void addObserver(Observer* observer){
			observers.push_back(observer);
		}

		virtual void notifyObservers(Observer* observer){
			for(ObserverList::iterator it = observers.begin(); it!=observers.end();++it){
				(*it)->update(observer);
			}
		}
};

#endif  // __OBSERVABLE_H__
